package com.itruth.data.preference;

import android.content.Context;
import android.content.SharedPreferences;

import com.itruth.base.ItruthApp;
import com.itruth.util.Constant;

public class ItruthPref {
	
	private static final String KEY_WRITE_TIMES = "write_times";
	private static final String KEY_SHARE_MIN_ID = "share_min_id";
	
	
	private static ItruthPref instance = new ItruthPref();
	
	private SharedPreferences pref;
	
	private ItruthPref() {

		pref = ItruthApp.getIns().getSharedPreferences("itruth_pref.xml",
				Context.MODE_PRIVATE);

	}

	public static ItruthPref getIns() {
		
		return instance;
	
	}
	
	public void setWriteTimes(int times) {
		
		pref.edit().putInt(KEY_WRITE_TIMES, times).commit();
		
	}
	
	public int getWriteTimes() {
		
		return pref.getInt(KEY_WRITE_TIMES, 0);
		
	}
	
	public void setShareMinId(int minId) {
		pref.edit().putInt(KEY_SHARE_MIN_ID, minId).commit();
	}
	
	public int getShareMinId() {
		return pref.getInt(KEY_SHARE_MIN_ID, 0);
	}
}
